package com.bqtv.sport.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bqtv.sport.bean.FootballAllStatisticsBean
import com.bqtv.sport.databinding.ItemActivityCenterBinding
import com.bqtv.sport.databinding.ItemLiveAllStatisticsBinding
import com.chad.library.adapter4.BaseQuickAdapter

class LiveAllStatisticsAdapter :
    BaseQuickAdapter<FootballAllStatisticsBean, LiveAllStatisticsAdapter.VH>() {
    class VH(
        parent: ViewGroup,
        val binding: ItemLiveAllStatisticsBinding = ItemLiveAllStatisticsBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        // 返回一个 ViewHolder
        return VH(parent)
    }

    override fun onBindViewHolder(holder: VH, position: Int, item: FootballAllStatisticsBean?) {
        // 设置item数据
        holder.binding.tvName.text = item?.name
        holder.binding.tvHome.text = item?.homeNum.toString()
        holder.binding.tvAway.text = item?.awayNum.toString()
        holder.binding.pbHome.progress = item?.homePercent?.toInt() ?: 0
        holder.binding.pbAway.progress = item?.awayPercent?.toInt() ?: 0
    }
}